package com.anxin.act.task.complete.impl;

import com.alibaba.fastjson.JSONArray;
import com.anxin.act.task.complete.TaskComplete;
import com.anxin.act.task.entity.WfActHiTask;
import com.anxin.act.task.service.*;
import com.anxin.act.task.vo.TaskVo;
import com.anxin.act.utils.ActTaskUtils;
import com.anxin.common.utils.sys.UserUtils;
import org.activiti.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 转签提交
 * @author: liuxiangyu
 * @date: 2020/4/26 16:22
 */
@Service
public class EntrustTaskCompleteImpl extends TaskComplete {


    @Autowired
    private WfActHiCommentService wfActHiCommentService;

    @Autowired
    private WfActRuTaskService wfActRuTaskService;

    @Autowired
    private JumpTaskService jumpTaskService;


    /**
     * 提交流程
     * @param taskVo
     */
    public String complete(TaskVo taskVo){
        wfActHiCommentService.addComment(taskVo,taskVo.getId());
        // 提交任务
        wfActRuTaskService.complete(taskVo.getId(),taskVo.getOpinions());

        ActTaskUtils.claimTask(taskVo.getActId());

        // 跳过节点
        jumpTaskService.jumpTask(taskVo.getActId(),taskVo.getId());

        return taskVo.getId();
    }
}
